package com.birdy.mapper;

import com.birdy.vo.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * @author birdy
 * @date 2022/3/31 10:15 PM
 */
@Mapper
public interface UserMapper {
    /**
     * 添加用户
     * @param openid openid
     * @param userInfo userinfo
     * @return add result
     */
    int addUserInfo(String openid, UserInfo userInfo);

    /**
     * 检查用户是否注册
     * @param openid user openid
     * @return user openid or null
     */
    String checkUserInfoRegister(String openid);

    /**
     * update user info
     * @param openid openid
     * @param userInfo userinfo
     * @return row num
     */
    int updateUserInfo(String openid, @Param("userInfo") UserInfo userInfo);

    /**
     * select user info by openid
     * @param openid openid
     * @return userinfo
     */
    UserInfo getUserInfo(String openid);
}
